package day11;
import java.io.*;
public class learn2 {
    public static void main(String[] args) throws IOException {
        //创建一个文件和路径
        /*File file=new File("D:\\WUDownloadCache\\我的青春谁做主.txt");
        //创建一个文件
        file.createNewFile();
       FileInputStream fileInputStream=new FileInputStream(file);
       File file1=new File("E:\\test.txt");
       FileOutputStream fileOutputStream1=new FileOutputStream(file1);
       int temp;
       try{
           while((temp=fileInputStream.read())!=-1){

           fileOutputStream1.write(temp);
           }

       }catch (Exception e){
           e.printStackTrace();
       }finally {
           fileInputStream.close();
           fileOutputStream1.close();
       }*/
        /*File file=new File("D:\\WUDownloadCache\\text.txt");
        file.createNewFile();
        OutputStream outputStream=new FileOutputStream(file,true);
        try{
            String str="你好,java,java语言很难";
            //文本转换为二进制字节，存储到数组中
            byte[] words=str.getBytes();
            outputStream.write(words);
            //刷新
            outputStream.flush();
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            outputStream.close();
        }
        /*InputStream inputStream=null;
try{
//文件的对象
File file =new File("D:\\\\WUDownloadCache\\\\test.txt");
//创建一个文件
file.createNewFile();
   inputStream = new FileInputStream(file);
            inputStream.available();
            int count=0;
            while((count=inputStream.read())!=-1){
             char ca=(char) count;
             System.out.print(ca);
            }

        }catch (Exception e) {
    e.printStackTrace();
}finally {
    inputStream.close();

}*/
    }

}
    //创建一个文件
        /*File  f=new File("D:\\WUDownloadCache\\test.txt");
        f.createNewFile();
        //获取文件的名称
        String path=f.getName();
        System.out.println("文件的名称:"+path);
        //获取绝对路径
        String path1=f.getAbsolutePath();
        System.out.println("相对路径:"+path1);
        //获取相对路径
        String path2=f.getPath();
        System.out.println("绝对路径:"+path2);
        Long leng=f.length();
        System.out.println("字节长度:"+leng);*/






